﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;
using System.Text;


namespace IHISCETeim.Web.MachineSys.PartsModel
{
    public partial class PartsDebtAdd : PageBase
    {
        protected override string DWZRef
        {
            get
            {
                return "PartsDebtList";
            }
        }

        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.新增 };
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "add")
            {
                addmenu();

            }
        }
        private void addmenu()
        {
            PartsDebtInfo obj = Request.SerializableObject<PartsDebtInfo>();
            obj.CardCode = GetRequestValue<string>("dwz.orgLookup.CardCode", "");
            obj.CardName = GetRequestValue<string>("dwz.orgLookup.CardName", "");
            obj.State = 0;
            obj.OldDebtId = 0;
            obj.ORDRNum = "";
            obj.ODLNNum = "";

            int did = PartsDebtController.Add(obj);
            if(did>0)
            { 
                SuccessJson("新增成功",this.DWZRef);
            }
            else
            {

                ErrorJson("新增失败" );
            }
        }
    }
}